<!DOCTYPE html>
<html>
<head>
	<title></title>
</head>
<body>
		<canvas id ="canvas" width="500" height="500" style="border:1px solid #000"></canvas>

</body>
</html>

<script type="text/javascript">
	var canvas = document.getElementById('canvas');
	var context = canvas.getContext('2d');
	context.fillStyle="#eeeeef";
	context.fillRect(0,0,500,500);
	var dx =150; /* 圆心坐标*/
	var dy =150; /*圆心坐标*/
	var s = 150; /*# 圆的半径*/
	context.beginPath();
	context.fillStyle ="rgb(100,255,100)";
	context.strokeStyle='rgb(0,0,100)';
	var x = Math.sin(0); /*# 任意起点划线的横坐标*/
	var y = Math.cos(0);/* 任意起点划线的纵坐标*/
	var dig = Math.PI/15*11; /*# 十五个起点，间隔十一个相连*/
	for (var i = 0; i < 30; i++) {
		var x = Math.sin(i*dig);

		var y = Math.cos(i*dig);
		context.lineTo(dx+s*x,dy+s*y); /*划线的终点*/
	}
	context.closePath();
	context.fill();
	context.stroke();
    /*var dig =2* Math.PI/8*1; 

	for (var i = 0; i < 8; i++) {
		var x = Math.sin(i*dig);

		var y = Math.cos(i*dig);
		context.lineTo(dx+s*x,dy+s*y);
	}
	context.closePath();
	context.fill();
	context.stroke(); 这里是画八边形*/
	</script>